<template>
  <div>
      <find @click="queryReport"></find>
      <a-table
        ref="table"
        :columns="columns"
        :data-source="list"
        :rowKey="(record) => record.id"
        >

            <template #index="text,record,index">
                {{ index+1 }}
            </template>

            <template #do>
              <a-space size="middle">
                <router-link to="">详情</router-link>
                <a>删除</a>
                <a>评论管理</a>
                <a>选入官方推荐</a>
              </a-space>
            </template>

      </a-table>
  </div>
</template>

<script>
import { getreportList } from "@/api/quanz/report";
import Find from '@/components/Find.vue';

export default {
  components: { Find },
    data() {
        return {
            list: [],
            columns: [
                {
                  title: "ID",
                  dataIndex: "id",
                  key: "id",
                },
                {
                  title: "序号",
                  key: "index",
                  scopedSlots: { customRender: "index" },
                },
                {
                  title: "帖子标题",
                  dataIndex: "title",
                  key: "title",
                },
                {
                  title: "帖子话题",
                  dataIndex: "content",
                  key: "content",
                },
                {
                  title: "发布用户",
                  dataIndex: "nickname",
                  key: "nickname",
                },
                {
                  title: "操作",
                  dataIndex: "do",
                  key: "do",
                  scopedSlots: { customRender: "do" },
                },
            ],
        }
    },
    methods:{
        //==========api===========
        getreportList(){
            getreportList({
                pageNumber: 1,
                pageSize: 20,
            }).then((res)=> {
                console.log("=========report=========", res.data);
                this.list = res.data.data.content;
            })
        },
        //=======find========
        queryReport(value){
            console.log(value);
        },
    },
    mounted(){
        this.getreportList();
    },
}
</script>

<style>
    
</style>